home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 103
/
Vol 103.iso
/
games
/
shark_at.swf
/
scripts
/
DefineSprite_82
/
frame_1
/
DoAction.as
Wrap
Text File
|
2010-03-13
|
2KB
|
60 lines
x = _X + _parent._x;
y = _Y + _parent._y;
width = _width / 2;
if(x + width < -100 || 650 < x - width)
{
gotoAndPlay(3);
}
if(x < _root.mascot._x)
{
slope = y - (x - _root.mascot._x) * _height / _width;
}
else
{
slope = y - (_root.mascot._x - x) * _height / _width;
}
if(x - width < _root.mascot._x && _root.mascot._x < x + width && (slope - _root.mascot.jumpspeed < _root.mascot._y + 40 && _root.mascot._y + 40 < slope + (slope + _height / 2 - slope)) && _root.mascot.jumping != true)
{
_root.mascot.air = false;
_root.mascot._y = slope - 40;
if(mascot != true)
{
_root.mascot.platform_contact = _root.mascot.platform_contact + 1;
mascot = true;
}
if(_name == "mainland" && x - width / 2 < _root.mascot._x)
{
_root.gotoAndStop("win");
}
}
else if(mascot == true)
{
if(_root.mascot.platform_contact == 1)
{
_root.mascot.air = true;
}
_root.mascot.platform_contact--;
mascot = false;
}
i = 1;
while(_root.enemies >= i)
{
enemy_x = _parent["enemy" + i]._x;
if(_X < enemy_x)
{
slope = _Y - (_X - enemy_x) * _height / _width;
}
else
{
slope = _Y - (enemy_x - _X) * _height / _width;
}
if(_X - width < enemy_x && enemy_x < _X + width)
{
_parent["enemy" + i].start_x = _X;
_parent["enemy" + i].dest_left = _X - width;
_parent["enemy" + i].dest_right = _X + width;
_parent["enemy" + i]._y = slope - 30;
}
i++;
}